package cn.datawin.routeserver.input.machine;

import lombok.extern.slf4j.Slf4j;
import org.squirrelframework.foundation.fsm.annotation.StateMachineParameters;
import org.squirrelframework.foundation.fsm.impl.AbstractUntypedStateMachine;


@Slf4j
@StateMachineParameters(stateType = String.class, eventType = String.class, contextType = Basket.class)
public class InputDealMachine extends AbstractUntypedStateMachine {

    public void onEntry(String from, String to, String event, Basket basket) {
//        String action = to;
//        JSONObject json = new JSONObject();
//        json.put("starttime", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss.SSS"));
//        json.put("exectime",0L);
//
//        basket.getExecMap().put(action,json);
    }
    public void onExit(String from, String to, String event, Basket basket) {
//        JSONObject execMap = new JSONObject(basket.getExecMap());
//        JSONObject actionMap = execMap.getJSONObject(from);
//        Date starttime = DateUtil.parse(actionMap.getString("starttime"),"yyyy-MM-dd HH:mm:ss.SSS").toJdkDate();
//        long exectime = new Date().getTime() - starttime.getTime();
//        actionMap.put("exectime",exectime);
//        log.info("action--{}--exectime--{}",from,exectime);
    }
}
